import tensorflow as tf
def get_jpeg_image(image_path,num_channels=3):
    """reads the jpg image from image_path.
    returns the image as a tf.float32 tensor
    Args:
        image_path:tf.string tensor
    Return:
        the decoded jpeg image casted to float32
    """
    return tf.image.convert_image_dtype(tf.image.decode_jpeg(tf.read_file(image_path),channels=num_channels),dtype=tf.float32)

def get_png_image(image_path,num_channels=3):
    """reads the png image from image_path.
    returns the image as a tf.float32 tensor
    Args:
        image_path:tf.string tensor
    Return:
        the decoded png image casted to float32
    """
    return tf.image.convert_image_dtype(tf.image.decode_png(tf.read_file(image_path),channels=num_channels),dtype=tf.float32)

def get_bmp_image(image_path,num_channels=3):
    """reads the bmp image from image_path.
    returns the image as a tf.float32 tensor
    Args:
        image_path:tf.string tensor
    Return:
        the decoded bmp image casted to float32
    """
    return tf.image.convert_image_dtype(tf.image.decode_bmp(tf.read_file(image_path),channels=num_channels),dtype=tf.float32)